var app = getApp();

Page({
    data: {
        _is_load: !0,
        is_akey: !1,
        ejecttp: !1,
        showModalStatus: !1,
        city: []
    },
    onLoad: function(t) {
        var a = this, e = t.cityid;
        a.setData({
            cityid: e
        }), app.util.request({
            url: "entry/wxapp/GetCitys",
            data: {
                m: "bbyscm_card",
                cityid: e
            },
            success: function(t) {
                console.log("读出的信息", t), 0 == t.data.errno && a.setData({
                    city: t.data.data,
                    mail_key: t.data.data.mail_key,
                    length: t.data.data.length
                });
            }
        }), app.util.footer(this), app.util.request({
            url: "entry/wxapp/Setup",
            data: {
                m: "bbyscm_card"
            },
            success: function(t) {
                a.setData({
                    setup: t.data.data,
                    apikey: t.data.data.apikey,
                    _is_load: !1
                });
            }
        }), app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card"
            },
            success: function(t) {
                0 == t.data.errno && a.setData({
                    my_card_info: t.data.data
                });
            }
        });
    },
    eject: function(t) {
        this.setData({
            ejecttp: !this.data.ejecttp,
            tpid: t.currentTarget.id
        });
    },
    ejectc: function(t) {
        this.setData({
            showModalStatus: !1,
            ejecttp: !1
        });
    },
    show_comments: function(t) {
        this.setData({
            reply_id: t.currentTarget.dataset.reply_id,
            p_card: t.currentTarget.dataset.p_card,
            p_name: t.currentTarget.dataset.p_name,
            pl_id: t.currentTarget.id,
            pl_openid: t.currentTarget.dataset.pl_openid,
            pl_name: t.currentTarget.dataset.pl_name,
            pl_card: t.currentTarget.dataset.pl_card,
            ejecttp: !1,
            showModalStatus: !0
        });
    },
    formSubmit_send_comments: function(t) {
        var a = t.detail.formId, e = this, d = t.detail.value.reply_id, i = t.detail.value.p_card, c = t.detail.value.p_name, s = t.currentTarget.id, r = t.detail.value.pl_openid, n = t.detail.value.pl_card, o = t.detail.value.pl_name, p = t.detail.value.pl_content;
        "" == i ? wx.showToast({
            title: "用户授权信息无,不可发布评论!"
        }) : "" == p ? wx.showToast({
            title: "评论内容不能为空!"
        }) : app.util.request({
            url: "entry/wxapp/Psend_comments",
            data: {
                m: "bbyscm_card",
                form_id: a,
                reply_id: d,
                pl_id: s,
                p_card: i,
                p_name: c,
                pl_card: n,
                pl_name: o,
                pl_openid: r,
                pl_content: p
            },
            success: function(t) {
                e.setData({
                    showModalStatus: !1
                });
                var a = e.data.city;
                a.pl_vity = t.data.data, e.setData({
                    city: a
                });
            }
        });
    },
    delete_comments: function(t) {
        var e = this, a = t.currentTarget.dataset.delid, d = t.currentTarget.id;
        wx.showModal({
            title: "提示",
            content: "您确定删除此条评论吗？",
            confirmText: "确定删除",
            success: function(t) {
                t.confirm && ("" == a ? wx.showToast({
                    title: "用户授权信息无,不可删除评论!"
                }) : app.util.request({
                    url: "entry/wxapp/Psend_comments",
                    data: {
                        m: "bbyscm_card",
                        pl_id: d,
                        del_id: a
                    },
                    success: function(t) {
                        var a = e.data.city;
                        a.pl_vity = t.data.data, e.setData({
                            city: a
                        });
                    }
                }));
            }
        });
    },
    fabulous: function(t) {
        var e = this, a = e.data.my_card_info.id, d = e.data.my_card_info.cardname, i = t.currentTarget.id, c = t.currentTarget.dataset.xx;
        "" == a ? wx.showToast({
            title: "用户授权信息无,无权限点赞!"
        }) : app.util.request({
            url: "entry/wxapp/Psend_fabulous",
            data: {
                m: "bbyscm_card",
                xx: c,
                pl_id: i,
                p_card: a,
                p_name: d
            },
            success: function(t) {
                e.setData({
                    ejecttp: !1
                });
                var a = e.data.city;
                a.fabulous = t.data.data, a.pt_openid = t.data.message, e.setData({
                    city: a
                });
            }
        });
    },
    onShareAppMessage: function() {
        var t = this;
        return {
            title: t.data.city.cityname,
            desc: t.data.city.cityname,
            path: "pages/city/citys/citys?cityid=" + t.data.city.id,
            success: function(t) {
                wx.showToast({
                    title: "转发成功",
                    icon: "success",
                    duration: 1e3,
                    mask: !0
                });
            },
            fail: function(t) {
                wx.showToast({
                    title: "转发失败",
                    icon: "error",
                    duration: 1e3,
                    mask: !0
                });
            }
        };
    },
    look_card_info_bind: function(t) {
        wx.navigateTo({
            url: "../../card/info/info?card_id=" + t.currentTarget.dataset.cardid
        });
    }
});